﻿using Business;
using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookManageSys.User
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnRegister_Click(object sender, EventArgs e)
        {
            UsersEntity ue = new UsersEntity();
            ue.Username = TxtUsername.Text;
            ue.Password = TxtPassword.Text;
            ue.Address = TxtAddress.Text;
            ue.Telephone = TxtTelephone.Text;

            UsersBusiness ub = new UsersBusiness();
            int res = ub.AddUser(ue);
            if (res > 0)
            {
                Response.Write("<script>alert('注册成功！'),location.href='../UserLogin.aspx'</script>");
            }
            else
            {
                Response.Write("<script>alert('注册失败！')</script>");
            }
        }
    }
}